var http = require('http');
var url = require('url');

function startServer(route,handle){
    function onRequest(request,response) {
        let urlObject = url.parse(request.url);
        console.log("Start route for "+request.url);
        route(handle,urlObject,response);
    }

    var server = http.createServer(onRequest);
    server.listen(3000,()=>{
        console.log("server start")
    });

}

module.exports = {
    startServer : startServer
}